Honestly way too much went into this single commit. I am so sorry future me
This commit is contained in:
24
project-warstone/src/services/game-systems.ts
Normal file
24
project-warstone/src/services/game-systems.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Schema } from '../types/schema';
|
||||
|
||||
export const GameSystemsService = {
|
||||
// todo - connect to service to save schema for game
|
||||
saveSchema: async (schema: Schema) => {
|
||||
localStorage.setItem('schema', JSON.stringify(schema));
|
||||
|
||||
return { status: 200 }
|
||||
},
|
||||
// todo - connect to service to fetch schema for game
|
||||
getSchema: async (id: string) => {
|
||||
const schema = localStorage.getItem('schema');
|
||||
|
||||
if (schema)
|
||||
return {
|
||||
status: 200,
|
||||
json: async () => JSON.parse(schema)
|
||||
}
|
||||
|
||||
return {
|
||||
status: 404
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user